<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head>
    <title>CheckBox 页示例</title>

    <th:block th:include="fragment_header :: header">
    </th:block>
</head>

<body>

<div th:replace="fragment_menu :: navmenu"></div>

<h1>Check Box 示例</h1>

<div class="card">
    <div class="card-body">


        <form action="#" th:action="@{ /demo/checkbox/save }" th:object="${cityModel}" method="post" class="form-horizontal">
            <div class="row">
                <label class="col-sm-2 col-form-label">区（大连市）</label>
                <div class="col-sm-10">
                    <div class="form-check" th:each="city: ${cityModel.cities}">
                        <input class="form-check-input" type="checkbox" name="cities"
                               th:value="${city.code}" th:field="*{selectedCities}" th:id="'city-' + ${city.code}"/>
                        <label class="form-check-label" th:for="'city-' + ${city.code}" th:text="${city.name}">city</label>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-10 offset-sm-2">
                    <div class="form-group">
                        <button type="submit" name="save" class="btn btn-primary">保存</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

</body>
</html>
